<template>
	<view>
		<!-- <view class="bg-white u-p-l-32 u-p-r-32 u-p-t-20 u-p-b-20 flex u-col-center u-row-between">
			<view class="flex u-col-center ">
				<u-icon name="search" size="50rpx" color="#999"></u-icon>
				<view>自定义搜索查询</view>
			</view>
			<u-icon name="arrow-right" size="14" color="#999"></u-icon>
		</view> -->

		<block v-for="(item,k) in orderBillList" :key="k">
			<view class="bg-white u-m-t-20 u-p-l-32 u-p-r-32 u-p-t-20 u-p-b-20 solid-bottom">
				<view class="flex u-col-center u-row-between">
					<view class="time">{{item.billTime}}</view>
					<!-- <view class="time">{{item.createTime}}</view> -->
				</view>
				<view class="flex u-col-center u-row-between u-m-t-10">
					<!-- <view class="jl">结算平台: </view> -->
					<view class="jl" v-if="item.settleType=='mt'" style="color: #ffcc33;">美团
						<!-- <text>{{item.isPrescription==1?'处方单':'非处方单'}}</text> -->
					</view>
					<view class="jl" v-if="item.settleType=='elem'" style="color: #108ee9;">饿了么
						<!-- <text>{{item.isPrescription==1?'处方单':'非处方单'}}</text> -->
					</view>
					<view class="jl">商家收入:￥{{parseFloat(item.settleAmount?item.settleAmount:0).toFixed(2)}}</view>
				</view>
				<view class="flex u-col-center u-row-between u-m-t-10">
					<view class="jl">服务费用: ￥{{parseFloat(item.serivceAmount?item.serivceAmount:0).toFixed(2)}}</view>
					<view class="jl">处方单费: ￥{{parseFloat(item.prescriptionAmount?item.prescriptionAmount:0).toFixed(2)}}
					</view>
				</view>
			</view>

		</block>
		<u-loadmore :status="status" :loadmoreText="loadText.loadmore" @loadmore="getmoreList()" :nomoreText="loadText.nomore" :loadingText="loadText.loading"/>
	</view>
</template>

<script>
	import {
		getOrderBillList
	} from '@/common/api/api.js'
	export default {
		data() {
			return {
				orderBillList: [],
				userInfoId: '',
				companyId: '',
				status: 'loadmore',
				list: 0,
				pageNum: 1,
				pageSize: 10,
				loadText: {
					loadmore: '点击加载更多',
					loading: '努力加载中',
					nomore: '没有更多了'
				},
				total: 0,
				nextPage: 0,
			}
		},
		onLoad(options) {
			this.companyId = options.centShopId;
			this.handleGetOrderBillList();
		},
		methods: {
			handleGetOrderBillList() {
				getOrderBillList({
					centShopId: this.companyId,
					pageNum: this.pageNum,
					pageSize: this.pageSize
				}).then(res => {
					// this.orderBillList = res.data.list;
					if (res.code == 200) {
						 res.data.list.map(item=>{
							 this.orderBillList.push(item)
						 })
						this.nextPage = res.data.nextPage;
						this.pageNum=res.data.nextPage;
						if (this.nextPage <= 0) {
							this.status = 'nomore';
						} else {
							this.status = 'loadmore';
						}

					}
				})
			},
			getmoreList() {
				this.status = 'loading';
				setTimeout(() => {
					this.handleGetOrderBillList();
				}, 1000)
			},

		}
	}
</script>

<style>
	.time {
		font-size: 28rpx;
		font-weight: 500;
		color: #999;
	}

	.jl {
		color: #999;
		font-size: 26rpx;
	}

	.name {
		color: #000;
	}

	.price {
		font-size: 32rpx;
		color: #000;
		font-weight: 600;
	}

	.datetime {
		color: #b1b1b1;
		margin-top: 10rpx;
	}

	.btn {
		background-color: #81D8CF;
		width: 100rpx;
		height: 40rpx;
		line-height: 40rpx;
		text-align: center;
		font-size: 24rpx;
		border-radius: 4rpx;
		color: #fff;
		font-weight: 400;
	}
</style>